#include <iostream>
#include <stdlib.h>
#include "AvlTree.h"
using namespace std; 	//introduces namespace std









//***************ONLY 4 DEBUG***********************************
void test1()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(5,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(2,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(3,11);
		cout<<"#3"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(9,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(7,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(8,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(10,10);
		cout<<"#7"<<endl;
		new_tree.InOrderPrint();
}





void test2()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(7,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(6,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(5,11);
		cout<<"#3"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(4,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(3,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(2,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(1,10);
		cout<<"#7"<<endl;
		new_tree.InOrderPrint();
}

void test3()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(1,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(2,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(3,11);
		cout<<"#3"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(4,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(5,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(7,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(8,10);
		cout<<"#7"<<endl;
		new_tree.InOrderPrint();
}

void lr_test()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(15,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(10,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(20,11);
		cout<<"#3"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(6,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(13,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(17,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(24,10);
		cout<<"#7"<<endl;
		new_tree.insert(4,10);
		cout<<"#8"<<endl;
		new_tree.insert(7,10);
		cout<<"#9"<<endl;
		new_tree.insert(12,10);
		cout<<"#10"<<endl;
		new_tree.insert(14,10);
		cout<<"#11"<<endl;
		new_tree.insert(11,10);
		cout<<"#12"<<endl;

		new_tree.InOrderPrint();
}


void rl_test()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(11,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(8,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(19,11);
		cout<<"#3"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(6,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(10,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(13,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(25,10);
		cout<<"#7"<<endl;
		new_tree.insert(12,10);
		cout<<"#8"<<endl;
		new_tree.insert(17,10);
		cout<<"#9"<<endl;
		new_tree.insert(23,10);
		cout<<"#10"<<endl;
		new_tree.insert(29,10);
		cout<<"#11"<<endl;
		new_tree.insert(15,10);
		cout<<"#12"<<endl;

		new_tree.InOrderPrint();
}

void Remove()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(5,9);
		cout<<"#1"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(2,10);
		cout<<"#2"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(8,11);
		cout<<"#3"<<endl;
		new_tree.insert(1,10);
		new_tree.insert(4,9);
		cout<<"#4"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(6,10);
		cout<<"#5"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(10,9);
		cout<<"#6"<<endl;
		new_tree.InOrderPrint();
		new_tree.insert(3,10);
		cout<<"#7"<<endl;
		new_tree.insert(7,10);
		cout<<"#8"<<endl;
		new_tree.insert(9,10);
		cout<<"#9"<<endl;
		new_tree.insert(12,10);
		cout<<"#10"<<endl;
		new_tree.insert(11,10);
		
		cout<<"#12"<<endl;

		new_tree.InOrderPrint();
		new_tree.remove(1);
		cout<<"after remove"<<endl;
		new_tree.InOrderPrint();

}

void Remove1()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(5,9);		
		new_tree.insert(2,10);		
		new_tree.insert(8,11);		
		new_tree.insert(1,10);
		new_tree.insert(4,9);		
		new_tree.insert(6,10);		
		new_tree.insert(10,9);		
		new_tree.insert(3,10);		
		new_tree.insert(7,10);		
		new_tree.insert(9,10);		
		new_tree.insert(12,10);		
		new_tree.insert(11,10);
		
		

		
		new_tree.remove(1);
		cout<<"after remove"<<endl;
		new_tree.InOrderPrint();

}
void Remove2()
{
		
		avl_tree<int, int> new_tree ;
		
		new_tree.insert(1,9);
		new_tree.insert(2,9);
		new_tree.insert(3,9);
		
		//new_tree.InOrderPrint();
		new_tree.remove(1);
		cout<<"after remove"<<endl;
		new_tree.InOrderPrint();

}

//***************ONLY 4 DEBUG END*******************************
int main()
{



Remove1();




}
